//Page Object
import {request} from "../../request/index.js"
Page({
  data: {
    swiperList:[],
    // 导航数组
    cateList:[],
    //楼层数据
    floorList:[]
  },
  //options(Object)
  //在onload函数中发送网络请求
  onLoad: function(options) {
    // wx-wx.request({
    //   url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata',
    //   success: (result) => {
    //     console.log(result);
    //     this.setData({
    //       swiperList:result.data.message
    //     })
    //   },
    // })
    this.getSwiperList(),
    this.getCateList(),
    this.getFloorList()
  },

  //获取轮播图数据
  getSwiperList(){
    request({url:"home/swiperdata"})
    .then( (result) => {
          this.setData({
            swiperList:result
          })
      },)
  },

  //获取分类导航数据
  getCateList(){
    request({url:"home/catitems"})
    .then( (result) => {
          console.log(result);
          this.setData({
            cateList:result
          })
      },)
  },

    //获取楼层数据
    getFloorList(){
      request({url:"home/floordata"})
      .then( (result) => {
            console.log(result);
            this.setData({
              floorList:result
            })
        },)
    }
});
  